<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CSC560 Design and Analysis of Real-Time Systems</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
	<div id="header">
		<h1>CSC560</h1>
		<h2>Design and Analysis of Real-Time Systems</h2>
		<ul>
			<li class="first">
				<a href="../index.html" accesskey="1" title="">Home</a>
			</li>
			<li>
				<a href="index.html" accesskey="2" title=""><b>Project 1</b></a>
			</li>
			<li>
				<a href="../project2/index.html" accesskey="3" title="">Project 2</a>
			</li>
			<li>
				<a href="../project3/index.html" accesskey="4" title="">Project 3</a>
			</li>
			<li>
				<a href="../project4/index.html" accesskey="4" title="">Project 4</a>
			</li>
			<li>
				<a href="../project5/index.html" accesskey="4" title="">Project 5</a>
			</li>
		</ul>
	</div>
</div>
<div id="content">
	<div id="colOne">
		<h2>Tutorials</h2>
		<p>
			In this section, we felt it would be a good idea to provide some
			tutorials for future students.
		</p>
		<h3>Tutorial 1: Programming the AT90USBKey on Linux</h2>
		<p>	
			First, since there has been a lack of documentation on how to setup
			a development environment for linux, we would like to provide
			guidelines on how to program the AT90USBKey on Ubuntu.
		</p>
		<p>
		 	This tutorial targets Ubuntu users, but could be easily ported to
			other linux distributions. Note that this tutorial
			has been tested on Ubuntu 9.04 Jaunty, and might not give the same 
			result under a different environment. 
		</p>
		<p>	
			In this tutorial, we are going to show
			how to setup Eclipse with AVR, as well as dfu-programmer which  is
			a replacement of flip on windows, and putty as a replacement of 
			Terra Term as a terminal.
		</p>
		<p>
			<b>Step 1: Installing Eclipse + AVR plugin</b>
			<br>
			Download Eclipse IDE for C/C++ Developers (67 MB) at www.eclipse.org/downloads
			<br>
			Untar and install eclipse somewhere on your home directory.
			<br>
			<br>
			<b>Step 2: Installing AVR plugin</b>
			<br>
			Launch Eclipse, select Help from the menu, and click on software updates.
			<br>
			In Software Updates, click on the tab: Available Software. 
			<br>
			Click on the button: Add Site, and enter the following location: 
			<br>
			http://avr-eclipse.sourceforge.net/updatesite/
			<br>
			Then click OK, you will see under Name the link you entered.
			<br>
			Check the box and click install. 
			<br>
			<br>	
			Now before relaunching eclipse, install the following packages:
			<br>
			sudo apt-get install gcc-avr
			<br>
			sudo apt-get install avr-libc
			<br>
			<br>
			Now after installation relaunch eclipse. 
			<br>
			Create a new C project, File, New->C Project.
			<br>
			Select AVR Cross Target Application->Empty Project, and Toolchains: AVR-GCC toolchain.
			<br>
			Click Next, Click Next again, choose AT90USB1287 microcontroller and your Frequency (8000000).
			<br>
			Click Finish.
			<br>
			Now in eclipse, go to tab Project, properties, click on C/C++ Build, Settings, 
			and check the box Generate HEX file for Flash memo in Tool Settings.
			<br>
			Then click build All from project, after you have create a new c file ...
			<br>
			A new directory Debug will be create and you should find your hex file in there.
			<br>
			<br>
			<b>Step 3: Install dfu-programmer, a replacement for Flip</b>
			<br>
			sudo apt-get install dfu-programmer
			<br>
			Plug in your device (AT90USBkey).
			<br>
			Make sure it is recognized:
			<br>
			lsusb | grep -i atmel
			<br>
			dmesg check the last outputs it should have show new device installed... 
			<br>
			Do a HWB->RST->RST->HWB
			<br>
			You must erase the memory before installing the new hex file. 
			<br>
			dfu-programmer at90usb1287 erase
			<br>
			Install the new hex file.
			<br>
			dfu-programmer at90usb1287 flash file.hex
			<br>
			RST button.
			<br>
			Test your program on the board.
			<br>
			<br>
			<b>Step 4: Install Putty, a replacement for Terra Term:</b>
			<br>
			Download putty:
			<br>
			then connect the uart to usb of computer.
			<br>
			dmesg | grep -i tty
			<br>
			You should see something like this:
			<br>
			[ 1003.425528] usb 7-1: FTDI USB Serial Device converter now attached to ttyUSB0
			<br>
			Notice at the end : ttyUSB0, this is the port to use as configuration to putty.
			<br>
			Launch putty.
			<br>
			Select serial.
			<br>
			In serial line, change /dev/ttyS0 to /dev/ttyUSB0 or whatever you tty is.
			<br>
			Change the speed to correspond to the speed you have set in your program.
			<br>
			Click open and start playing...
			<br>
		</p>		
	</div>
	<div id="colTwo">
		<h3>Project Sections</h3>
		<ul>
			<li class="first"><a href="hardware.html">Hardware Description</a></li>
			<li><a href="design.html">Software Design</a></li>
			<li><a href="development_process.html">Development Process</a></li>
			<li><a href="../doxygen/html/index.html">Doxygen</a></li>
			<li><a href="tutorial.html">Tutorial</a></li>
			<li><a href="http://code.google.com/p/wireless-roomba">Google Code</a></li>
		</ul>
	</div>
</div>
<div id="footer">
	<p>@ 2009. All Rights Reserved. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
</div>
</body>
</html>
